<style type="text/css">
    .parent {
        height: 100%;
        width: 100%;
        display: flex;
        justify-content: center; /* 水平居中 */
        align-items: center;     /* 垂直居中 */
    }
    .child {
        background-color: cadetblue;
    }
</style>
<div class="parent">
    <div class="child"><p>Hello World!</p></div>
</div>